# 作者: 家里蹲 吴越洋
# 2023年03月01日20时13分07秒
import random
class Sort():
    def __init__(self,num):
        self.arr=[]
        self.len=num
        self.arr_random()

    def arr_random(self):
        for i in range(self.len):
            self.arr.append(random.randint(0,99))

    def print_arr(self):
        for i in self.arr:
            print(i,end=' ')

    def pivit(self,left,right):
        arr=self.arr
        pit=arr[left]
        while left<right:
            while left<right and pit<=arr[right]:
                right-=1
            arr[left]=arr[right]
            while left<right and pit>arr[left]:
                left+=1
            arr[right]=arr[left]
        arr[left]=pit
        return left

    def quick_sort(self,left,right):
        if left<right:
            mid=self.pivit(left,right)
            self.quick_sort(left,mid-1)
            self.quick_sort(mid+1,right)


if __name__ == '__main__':
    sort=Sort(10)
    sort.print_arr()
    print('\n')
    sort.quick_sort(0,9)
    sort.print_arr()